import Vue from 'vue'
import Router from 'vue-router'
//当app.js很小的时候，不建议按照下面component的写法异步引入组件，这里只是做异步组件的测试使用

Vue.use(Router)

export default new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  routes: [
    {
      path: '/',
      name: 'home',
      component:()=> import("./views/Home.vue")
    },
    {
      path:"/city",
      name:"city",
      component:()=>import("./views/City.vue")
    },{
      path:"/detail/:id",
      name:"detail",
      component:()=>import ("./views/Detail.vue")
    }
  ],
  scrollBehavior (to,from,savedPosition){
   return {x:0,y:0}
  }
})
